package hos.demo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.button.MaterialButton
import hos.bus.LiveBus

/**
 * <p>Title: BusActivity </p>
 * <p>Description:  </p>
 * <p>Company: www.mapuni.com </p>
 *
 * @author : 蔡俊峰
 * @date : 2022/7/27 17:26
 * @version : 1.0
 */
class BusActivity : AppCompatActivity(R.layout.activity_live_bus) {

    private val bus by lazy { findViewById<MaterialButton>(R.id.bus) }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        bus.setOnClickListener {
            LiveBus.with<String>("content").postValue(bus.text.toString())
            LiveBus.once<String>("contentOnce").postValue(bus.text.toString())
        }
        LiveBus.on(this).postDelayed({

        }, 100)
        LiveBus.on(this).post {

        }
    }
}